<template>
    <div class="electroniciindex">
        <Card class="clearfix" style="padding-bottom: 16px">
            <p slot="title">
                电子签认证
            </p>
            <Form label-position="left" :label-width="84">
                <Row :gutter="24">
                    <i-col span="6">
                        <FormItem label="签约人姓名：">
                            <Input v-model="search.username" placeholder="请输入签约人姓名"/>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                        <FormItem label="签约人手机：">
                            <Input v-model="search.userphone" placeholder="请输入签约人手机"/>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                    <FormItem label="身份证号：">
                        <Input v-model="search.signerCardNumber" placeholder="请输人签约人身份证号"/>
                    </FormItem>
                    </i-col>
                    <i-col span="6">
                        <FormItem label="电子邮件：">
                            <Input v-model="search.email" placeholder="请输人电子邮件"/>
                        </FormItem>
                    </i-col>
                </Row>
                <Row :gutter="24">
                    <i-col span="6">
                        <FormItem label="企业名称：">
                            <Input v-model="search.companyname" placeholder="请输入企业名称"/>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                        <FormItem label="签章方式：">
                            <Select clearable v-model="search.signatureType">
                                <Option  :value="1" >法人</Option>
                                <Option  :value="2" >代理人</Option>
                            </Select>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                        <FormItem label="审核状态：">
                            <Select clearable v-model="search.auditStatus">
                                <Option  :value="3" >待审核</Option>
                                <Option  :value="1" >审核成功</Option>
                                <Option  :value="2" >审核失败</Option>
                                <Option  :value="4" >签章验证中</Option>
                            </Select>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                        <FormItem label="审核时间：">
                            <Date-picker type="daterange" v-model="search.audittime" placement="bottom-end" placeholder="选择日期"></Date-picker>
                        </FormItem>
                    </i-col>
                </Row>
                <Row :gutter="12">
                    <i-col span="6">
                        <FormItem label="创建时间：" class="create">
                            <Date-picker type="daterange" v-model="search.createtime" placement="bottom-end" placeholder="选择日期"></Date-picker>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                        <Button type="success" @click="searchData" icon="ios-search" >搜索</Button>
                    </i-col>
                </Row>

            </Form>
            <br>
            <div>
                <list-table refs="table1" v-model="table.list"  :table-data="table.list"></list-table>
            </div>
            <Page ref="pages" :total="table.itemTotal" show-total style="float: right; margin-top: 20px" @on-change="getList"></Page>
        </Card>
    </div>
</template>

<script>
    import listTable from './components/listTable.vue'
    import ajax from '../../../libs/axios.js'
    import moment from "moment";
    export default {
        name: 'personalindex',
        components: {
            listTable
        },
        data () {
            return {
                search:{
                    username:"",          // 签约人姓名
                    userphone:"",         // 签约人手机号
                    signerCardNumber:"",  // 签约人身份证号
                    email:"",             // 电子邮件
                    companyname:"",       // 企业名称
                    signatureType:"",     // 签章方式
                    auditStatus:"",       // 审核状态
                    audittime:[],         // 审核时间
                    createtime:[],        // 创建时间

                },
                table:{
                   list:[],            // 表格数据
                   itemTotal:1,        // 数据条数
                },
            }
        },
        methods: {
            init () {
                this.getList(1)
            },
            searchData () {
                if (this.search.signatureType == undefined){
                    this.search.signatureType=""
                }
                if (this.search.auditStatus == undefined){
                    this.search.auditStatus=""
                }
                this.getList(1)
            },
            getList (page) {

                let startDate=this.search.createtime[0] == "" ? "" : moment(this.search.createtime[0]).format("YYYY-MM-DD") ;
                let endDate=this.search.createtime[1] == "" ? "" : moment(this.search.createtime[1]).format("YYYY-MM-DD");
                let startAuditDate=this.search.audittime[0] == "" ? "" : moment(this.search.audittime[0]).format("YYYY-MM-DD");
                let endAuditDate=this.search.audittime[1] == "" ? "" : moment(this.search.audittime[1]).format("YYYY-MM-DD");

                let url = 'adminlogin/ebq/selectInfos.html'
                let data = {
                    pageSize: 10,
                    pageNum: page,
                    signerType:this.search.signatureType,         // 签约人类型
                    signerName:this.search.username,              // 签约人姓名
                    signerPhone:this.search.userphone,            // 签约人电话
                    signerCardNumber:this.search.signerCardNumber,// 签约人身份证号
                    email:this.search.email,                      // 企业邮箱
                    authStatus:this.search.auditStatus,           // 审核状态
                    partyName:this.search.companyname,            // 企业名称
                    startDate:startDate,                          // 创建开始时间
                    endDate:endDate,                              // 创建结束时间
                    startAuditDate:startAuditDate,                // 审核开始时间
                    endAuditDate:endAuditDate,                    // 审核结束时间
                }
                ajax.formRes(url, data).then(res => {
                    this.table.list = res.data;
                    this.table.itemTotal = res.count;
                }).catch(err => {
                    console.log('有错误信息')
                })
            },
        },
        mounted () {
            this.init()
        },
        activated() {
            this.init()
        },
    }
</script>


<style lang="less">
    @import "../../../styles/common.less";
    @import "../../../styles/table.less";
    .electroniciindex .create .ivu-date-picker .ivu-select-dropdown{
        left: inherit !important;
    }
</style>

